<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>统战成员学习平台</title>
	<link rel="stylesheet" type="text/css" href="../../css/base.css" />
	<link rel="stylesheet" type="text/css" href="../../css/discovery.css" />
</head>

<body>
	<div id='app' style="display:none" v-show="true">
		<div v-for="item of items" class="user_lesson">
			<p class="name"><i class="icon_chapter_grey"></i>{{item.scheduleName}}</p>
			<p class="time">{{item.startTime.split(' ')[0].replace(/\-/g, '.') + ' - ' + item.endTime.split(' ')[0].replace(/\-/g, '.')}}</p>
			<!-- <p class="exam"><i class="icon_exam_grey"></i>综合考试：<span>{{item.testStatus?'已开始':'未开始'}}</span></p> -->
			<p class="progress" v-if="item.rateStr"><i class="icon_pro_grey"></i>学习进度：{{item.rateStr}}%</p>
		</div>
		<div v-if="isLastPage" class="user_lesson_no_more">没有更多了</div>
	</div>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/vue.min.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/layer_mobile/layer.js"></script>
	<script type="text/javascript">
		new Vue({
			el: '#app',
			data: {
				userId: 0,
				items: [],
				loading: false,
				isLastPage: false,
				pageNum: 1,
				pageSize: 10,
			},
			mounted: function() {
				var $this = this;
				apiready = function() {
					api.parseTapmode();
					$this.userId = api.pageParam.userId;
					$this.getList();
					onScrollToBottom(function () {
						if ($this.isLastPage) return;
						$this.getList()
					});
				}
			},
			methods: {
				getList: function() {
					var $this = this;
					if ($this.loading) return;
					if ($this.userId) {
						$this.loading = true;
						post('/client/schedule/selectScheduleList', {
							otherId: $this.userId,
							pageNum: $this.pageNum,
							pageSize: $this.pageSize,
						}, function(ret) {
							$this.loading = false;
							if(ret.isSuccess){
								ret.data.list.forEach(function(item) {
									$this.items.push(item);
								});
								ret.data.isLastPage ? $this.isLastPage = true : $this.pageNum++;
							}else {
								$this.isLastPage = true;
							}
							parseTapmode();
						})
					}
				}
			}
		});
	</script>
</body>

</html>
